<template>
  <view class="good_item">
    <image :src="gooditem.coverUrl[0]" class="good_img" mode="aspectFit" />
    <view class="good_info">
      <view class="name">{{ gooditem.title }}</view>
      <view class="sales">销售：{{ gooditem.salesVolume }}</view>
      <view class="price">
        ￥
        <text class="price_text">{{ gooditem.price }}</text>
      </view>
    </view>
    <view class="btn" @click="sel(gooditem.id)">选规格</view>
  </view>
</template>

<script lang="ts" setup>
interface goodItem {
  title: string;
  coverUrl: any;
  salesVolume: string;
  price: string;
  id: any;
}
defineProps<{
  gooditem: goodItem;
}>();
const emit = defineEmits(['sel']);
function sel(id: any) {
  emit('sel', { id });
}
</script>

<style lang="scss">
.good_item {
  width: 553rpx;
  height: 202rpx;
  background: #ffffff;
  box-shadow: 0rpx 2rpx 4rpx 0rpx rgba(0, 0, 0, 0.1);
  border-radius: 20rpx;
  margin: 20rpx auto;
  position: relative;
  display: flex;
  .good_img {
    width: 190rpx;
    height: 190rpx;
    border-radius: 20rpx;
    background-color: #efefef;
  }
  .good_info {
    margin-left: 22rpx;
    .name {
      font-size: 28rpx;
      font-weight: 500;
      color: rgba(0, 0, 0, 0.8);
    }
    .sales {
      font-size: 20rpx;
      font-weight: 400;
      color: rgba(0, 0, 0, 0.6);
    }
    .price {
      font-size: 24rpx;
      font-weight: 400;
      color: #ba2636;
      margin-top: 54rpx;
    }
    .price_text {
      font-size: 48rpx;
      font-weight: 500;
      color: #ba2636;
    }
  }

  .btn {
    width: 160rpx;
    height: 80rpx;
    background: #ba2636;
    border-radius: 62rpx;
    font-size: 30rpx;
    font-family: Source Han Sans CN-Regular, Source Han Sans CN;
    font-weight: 400;
    color: #ffffff;
    text-align: center;
    line-height: 40rpx;
    position: absolute;
    bottom: 14rpx;
    right: 40rpx;
    line-height: 80rpx;
  }
}
</style>
